<template>
  <uni-countdown :day="day"
                 :hour="hour"
                 :minute="minute"
                 :second="second"
                 :font-size="30"
                 color="#FFFFFF" />
</template>

<script setup lang="ts">

import {defineProps, ref} from "vue";
import {onReady} from "@dcloudio/uni-app";
import myMoment from "@/utils/common/myMoment";


/**
 * 给一个未来时间
 * 倒计时
 */
const props =defineProps({
  time:{
    type:String,
    default:'',
  }
})
const day=ref()
const hour =ref()
const minute =ref()
const second =ref()

onReady(()=>{
  console.log(props.time)
  second.value=myMoment(props.time).diff(myMoment(),'seconds')%60
  console.log(second.value)
  minute.value=myMoment(props.time).diff(myMoment(),'minutes')%60
  console.log(minute.value)
  hour.value=myMoment(props.time).diff(myMoment(),'hours')%24
  console.log(hour.value)
  day.value=myMoment(props.time).diff(myMoment(),'days')
  console.log(day.value)
})




</script>

<style scoped>

</style>